package com.itshare.video.mapper;

import com.itshare.video.pojo.po.Fans;
import com.itshare.video.pojo.po.FansExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.session.RowBounds;

public interface FansMapper {
    long countByExample(FansExample example);

    int deleteByExample(FansExample example);

    @Delete({
        "delete from t_fans",
        "where autoGenId = #{autogenid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer autogenid);

    @Insert({
        "insert into t_fans (user_id, fans_id)",
        "values (#{userId,jdbcType=INTEGER}, #{fansId,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="autogenid", before=false, resultType=Integer.class)
    int insert(Fans record);

    int insertSelective(Fans record);

    List<Fans> selectByExampleWithRowbounds(FansExample example, RowBounds rowBounds);

    List<Fans> selectByExample(FansExample example);

    @Select({
        "select",
        "autoGenId, user_id, fans_id",
        "from t_fans",
        "where autoGenId = #{autogenid,jdbcType=INTEGER}"
    })
    @ResultMap("com.itshare.video.mapper.FansMapper.BaseResultMap")
    Fans selectByPrimaryKey(Integer autogenid);

    int updateByExampleSelective(@Param("record") Fans record, @Param("example") FansExample example);

    int updateByExample(@Param("record") Fans record, @Param("example") FansExample example);

    int updateByPrimaryKeySelective(Fans record);

    @Update({
        "update t_fans",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "fans_id = #{fansId,jdbcType=INTEGER}",
        "where autoGenId = #{autogenid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Fans record);
}